package com.example.myshop.slice;

import com.example.myshop.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Component;
import ohos.agp.components.Image;

public class WelcomeAbilitySlice extends AbilitySlice {
    Image logoImage;//欢迎页面图片
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_welcome);
        logoImage=findComponentById(ResourceTable.Id_logo);//初始化图片
        logoImage.setClickedListener(new Component.ClickedListener() {
            @Override//设置点击事件，当点击时通过显示intent跳转至LoginAbility
            public void onClick(Component component) {
                Intent newIntent = new Intent();
                Operation operation = new Intent.OperationBuilder()
                        .withDeviceId("")
                        .withBundleName("com.example.myshop")
                        .withAbilityName("com.example.myshop.LoginAbility")
                        .build();

                newIntent.setOperation(operation);
                startAbility(newIntent);
            }
        });
    }
    @Override
    public void onActive() {
        super.onActive();
    }
    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}

